//
//  XHAssembledViewController.m
//  围脖
//
//  Created by 魏兴浩 on 15/12/12.
//  Copyright © 2015年 wxh. All rights reserved.
//

#import "XHAssembledViewController.h"
#import "XHVisitor.h"
#import "XHHomeViewController.h"
#import "XHDiscoverViewController.h"
#import "XHMessageViewController.h"
#import "XHProfileViewController.h"
#import "XHAuthorizeController.h"
@interface XHAssembledViewController ()<XHVistorDelegaet>
@property (nonatomic,strong)XHVisitor *visitor;
@end

@implementation XHAssembledViewController
-(XHVisitor *)visitor{
    if (_visitor == nil) {
        _visitor = [[XHVisitor alloc]init];
    }
    return _visitor;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    //设置Visitor代理
    self.visitor.deleaget = self;
}
-(void)loadView{
    [super loadView];
    BOOL user = NO;
    if (user) {

    }else{
        //访客视图
        [self setUpVisitorView];
        //设置不同页面部同的内容
        if ([self.class isSubclassOfClass:[XHHomeViewController class]]) {
        //设置首页转轮动画
        [self.visitor IcomViewRotationAnimation];
            
        }else if([self.class isSubclassOfClass:[XHMessageViewController class]]){
            [self.visitor setVisitorView:@"visitordiscover_image_message" andMessage:@"登录后,别人评论你的微博,发给你的消息,都会在这里受到通知"];
            
        }else if ([self.class isSubclassOfClass:[XHDiscoverViewController class]]){
            [self.visitor setVisitorView:@"visitordiscover_image_message" andMessage:@"登录后,最新、最热微博尽在掌握,不再会与实时潮流擦肩而过"];
            
        }else if ([self.class isSubclassOfClass:[XHProfileViewController class]]){
            [self.visitor setVisitorView:@"visitordiscover_image_profile" andMessage:@"登录后,你的微博、相册、个人资料会显示在这里,展示给别人"];
        }
        //设置导航栏按钮
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"注册" style:UIBarButtonItemStylePlain target:self action:@selector(leftBarBtnClick)];
        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"登录" style:UIBarButtonItemStylePlain target:self action:@selector(righBarBtnClick)];
    }


}
#pragma mark -导航栏按钮点击事件
-(void)leftBarBtnClick{
    NSLog(@"点击导航栏注册按钮");
}
-(void)righBarBtnClick{
    NSLog(@"点击导航栏登录按钮");
}
#pragma  mark - 访客视图
-(void)setUpVisitorView{
    self.view = self.visitor;
    self.visitor.backgroundColor = [UIColor colorWithRed:234/255.0 green:234/255.0 blue:234/255.0 alpha:1];
}
#pragma mark -VisitorDelegaet
-(void)vistorLoginClick{
    NSLog(@"点击visitor的代理");
    XHAuthorizeController *authorView = [[XHAuthorizeController alloc]init];
    UINavigationController *nvc = [[UINavigationController alloc]initWithRootViewController:authorView];
    [self presentViewController:nvc animated:YES completion:nil];
    
}

@end
